package com.letv.core.api;

import com.letv.core.config.LetvConfig;
import com.letv.core.db.PreferencesManager;

/**
 * 接口常量
 * 
 * @author zhuqiao
 * 
 */
/**
 * 用户信息移入该类
 * @author 吴新荣
 *
 */
public class UrlConstdata {

	/**
     * 动态请求BaseUrl
     * */
    private final static String USER_DYNAMIC_APP_URL = "http://dynamic.user.app.m.letv.com/android/dynamic.php";

    /**
     * 公共参数
     */
    public interface PUBLIC_PARAMETERS {

        String MOD_KEY = "mod";

        String CTL_KEY = "ctl";

        String ACT_KEY = "act";

        String MARKID_KEY = "markid";

        String PCODE_KEY = "pcode";

        String VERSION_KEY = "version";

        String CT_KEY = "ct";

        String ID_KEY = "id";

        String LUAMOD_KEY = "luamod";
    }

    /**
     * 请求用户信息参数
     * */
    public interface GETUSERBYTK_PARAMETERS {

        String MOD_VALUE = "passport";

        String CTL_VALUE = "index";

        String ACT_VALUE = "getUserByTk";

        String ACT_THIRD_VALUE = "thirdUserLogin";

        String TK_KEY = "tk";

        String DEVID_KEY = "devid";
    }
    
    /**
     * 请求个性化推荐数据参数
     */
    public interface DIALOG_PARAMETERS {

        String MOD_VALUE = "minfo";

        String CTL_VALUE = "message";

        String ACT_VALUE = "index";

        String MARKID = "markid";
    }

    public interface DISCOVER_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "discover";

        String ACT_VALUE = "index";
    }

    /**
     * 请求专题数据包参数
     */
    public interface TOPIC_CHANNEL_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "subjectlist";

        String ACT_TOP_VALUE = "index";

        String ACT_HOT_VALUE = "hot";
    }

    /**
     * 请求服务器时间接口参数
     */
    public interface GET_DATE_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "booklive";

        String ACT_VALUE = "getDate";
    }

    public interface LIVE_PARAMETERS {
        String CLIENT_ID = "clientId";
        String BELONGAREA = "belongArea";
        String SIGNAL = "signal";
        String WITH_UNCLASS = "withUnclass";
        String IS_PAY = "isPay";
        String WITH_ALL_STREAM = "withAllStreams";
        String CHANNEL_ID = "channelId";
        String STREAM_ID = "streamId";
    }

    /**
     * 直播防盗链参数
     * */
    public interface ANTI_LEECH_PARAMETERS {

        String FORMAT = "format";

        String EXPECT = "expect";
    }

    /**
     * 点播防盗链参数
     * */
    public interface TIMESTAMP_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "timestamp";

        String ACT_VALUE = "timestamp";
    }

    /**
     * 直播防盗链参数
     * */
    public interface EXPIRE_TIMESTAMP_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "timeexpirestamp";

        String ACT_VALUE = "timeExpireStamp";
    }

    /**
     * 点播，专题合并接口参数
     * */
    public interface COMBINE_PARAMETERS {
        // play/tabs 初次请求获取的tabs签参数
        String CID_KEY = "cid";// 频道id

        String ZID_KEY = "zid";// 小专题id

        String PID_KEY = "pid";// 专辑id

        String VID_KEY = "vid";// 视频id ( zid/vid/pid 不能同时为空，优先级为zid > vid > pid )

        // play/vlist 剧集play/vlist接口参数
        String PAGENUM_KEY = "pagenum";// 当前页数

        String PAGESIZE_KEY = "pagesize";// 当前页数

        String YEAR_KEY = "year";// 当前页数

        String MONTH_KEY = "month";// 当前页数
    }

    /**
     * 下载接口参数
     */
    public interface DOWNLOAD_PARAMETERS {

        String MMSID = "mmsid";

        String PLAYID = "playid";

        String TSS = "tss";

        String ISLOGIN = "islogin";

        String PCODE = "pcode";

        String TM = "tm";

        String KEY = "key";

        String VERSION = "version";

        String VID = "vid";

        String LEVEL_TYPE = "levelType";

        String MOD = "mod";

        String CTL = "ctl";

        String ACT = "act";

        String VIDEOFORMAT = "videoFormat";
    }

    /**
     * 获取公共静态尾
     * 
     * @return
     */
    public static String getStaticEnd() {
        return STATIC_APP_BASE_END;
    }

    /**
     * 静态请求end
     */
    private static final String STATIC_APP_BASE_END = ".mindex.html";

    /**
     * 正式接口
     */
    public interface OFFICIAL_URL {
        /**
         * 直播大厅
         */
        String DYNAMIC_APP_LIVE_URL = "http://dynamic.live.app.m.letv.com/android/dynamic.php";

        /**
         * 静态请求head
         * */
        String LIVE_STATIC_APP_HEAD = "http://static.live.app.m.letv.com/android";

        /**
         * 用户中心
         */
        String DYNAMIC_APP_USERURL = "http://dynamic.user.app.m.letv.com/android/dynamic.php";
                // 升级下载APP送会员

        /**
         * 用户中心静态请求头
         */
        String USER_STATIC_APP_HEAD = "http://static.user.app.m.letv.com/android";

        /**
         * 动态请求BaseUrl
         */
        String DYNAMIC_APP_BASE_URL = "http://dynamic.app.m.letv.com/android/dynamic.php";

        /**
         * 静态请求head
         */
        String STATIC_APP_BASE_HEAD = "http://static.app.m.letv.com/android";

        /**
         * 个性化推荐静态请求head
         */
        String RECOMMEND_APP_BASE_HEAD = "http://recommend.app.m.letv.com/android";
                // (version>=5.2.2)

        /**
         * 正式推送接口
         */
        String APP_PUSH_BASE_URL = "http://msg.m.letv.com/android/index.php";

        /**
         * 热点正式接口
         */
        String STATIC_APP_HOT_HEAD = "http://static.meizi.app.m.letv.com/android";

        /**
         * 联通wo流量正式接口
         */
        String STATIC_APP_WO_BASE_URL = "http://api.";
        /**
         * 媒资动态请求BaseUrl
         */
        String MEDIA_ASSET_DYNAMIC_APP_URL =
                "http://dynamic.meizi.app.m.letv.com/android/dynamic.php";

        /**
         * 媒资静态请求head
         */
        String MEDIA_ASSET_STATIC_APP_HEAD = "http://static.meizi.app.m.letv.com/android";
        /*
         * 接口合并请求正式Url
         */ String COMBINE_APP_URL_NORMAL = "http://api.mob.app.letv.com/";

        /**
         * 动态请求BaseUrl
         */
        String PAY_DYNAMIC_APP_URL = "http://dynamic.pay.app.m.letv.com/android/dynamic.php";
    }

    /**
     * 测试接口
     */
    public interface TEST_URL {

        /**
         * 动态请求BaseUrl
         * */
        String LIVE_DYNAMIC_APP_URL = "http://dynamic.live.app.m.letv.com/android/dynamic.php";

        /**
         * 动态请求BaseUrl
         */
        String DYNAMIC_TEST_BASE_URL = "http://test2.m.letv.com/android/dynamic.php";

        /**
         * 静态请求head
         */
        String STATIC_TEST_BASE_HEAD = "http://test2.m.letv.com/android";

        /**
         * 测试推送接口
         */
        String PUSH_TEST_BASE_URL = "http://10.204.28.31:9030/android/index.php";

        /**
         * 联通wo流量测试
         */
        String WO_TEST_BASE_URL = "http://test.push.";
        /*
         * 测试和审核,接口合并请求测试Url
         */ String COMBINE_APP_URL_TEST = "http://t.api.mob.app.letv.com/";
    }

    /**
     * 海外IP地址
     */
    public static final String IP_BASE_URL = "http://api.letv.com/getipgeo";

    /**
     * 个性化推荐接口
     * 
     * @author zhangjianfang
     * 
     */
    public interface RECOMMEND_API {
        /**
         * 动态请求BaseUrl
         * */
        String RECOMMEND_DYNAMIC_APP_URL =
                "http://dynamic.recommend.app.m.letv.com/android/dynamic.php";

        /**
         * 静态请求head
         * */
        String RECOMMEND_STATIC_APP_HEAD = "http://static.recommend.app.m.letv.com/android";
    }

    /**
     * 个性化推荐接口
     * 
     * @author zhangjianfang
     * 
     */
    public interface RECOMMEND_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "detailRecommend";

        String ACT_VALUE = "list";

        String DETAIL_CID = "cid";

        String DETAIL_PID = "pid";

        String DETAIL_VID = "vid";

        String NUM = "num";

        String UID = "uid";

        String DEV_ID = "devid";
    }

    /**
     * 请求首页个性化推荐接口参数
     * http://dynamic.recommend.app.m.letv.com/android/dynamic.php?
     * mod=mob&ctl=homerecommend&act=index&evid={$devid}&uid={$uid}
     * &history={$history}&pcode={$pcode}&version={$version}
     */
    public interface HOME_RECOMMEND_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "homerecommend";

        String ACT_VALUE = "index";

        String DEVICEID_KEY = "devid";

        String UID_KEY = "uid";

        String HISTORY_KEY = "history";
    }

    /**
     * 请求频道列表数据参数
     */
    public interface CHANNELS_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "channelinfopageidblock";

        String ACT_VALUE = "index";
    }

    /**
     * 请求频道首页数据参数（5.5新接口）
     */
    public interface CHANNEL_HOME_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "channelindex55";

        String ACT_VALUE = "index";

        String CID_KEY = "cid";

        String UID_KEY = "uid";

        String DEVID_KEY = "devid";

        String HISTORY_KEY = "history";

        String PAGE_ID = "pageid";
    }

    /**
     * 请求频道分类、地区、年份接口参数
     */
    public interface CHANNEL_SIFT_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "filter";

        String ACT_VALUE = "index";
    }

    /**
     * 请求大媒资专辑、视频列表参数
     */
    public interface MZ_ALBUM_OR_VIDEOS_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VIDEO_VALUE = "listvideo";

        String CTL_ALBUM_VALUE = "listalbum";

        String ACT_VALUE = "index";

        String SRC_KEY = "src";// 来源 1站内 2 站外 默认不传

        String CID_KEY = "cg";// 频道ID

        String CV_KEY = "cv";// 码流

        String PH_KEY = "ph";// 播放平台

        String PT_KEY = "pt";// 付费平台

        String PN_KEY = "pn";// 第几页

        String PS_KEY = "ps";// 每页多少条数据
    }

    /**
     * 请求热门排行接口参数
     */
    public interface TOP_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "dayplaytopchannel";

        String CTL_HOT_VALUE = "dayplaytop";

        String ACT_VALUE = "index";

        String CID_KEY = "cid";
    }

    /**
     * 请求首页直播数据接口参数
     * v5.8.1启用新的首页直播接口
     * */
    public interface HOME_LIVELIST_PARAMETERS {

        String LUAMOD_VALUE = "main";

        String MOD_VALUE = "live";

        String CTL_VALUE = "liveRoomByChannel";

        String CTL_HOME_VALUE = "liveRoomByAll";

        String ACT_VALUE = "index";
    }

    /**
     * 请求直播预定接口参数
     * */
    public interface ADD_BOOKLIVE_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "booklive";

        String ACT_VALUE = "add";

        String DEV_ID_KEY = "dev_id";

        String PLAY_TIME_KEY = "play_time";

        String P_NAME_KEY = "p_name";

        String CHANNEL_CODE_KEY = "channel_code";

        String CHANNEL_NAME_KEY = "channel_name";

        String CHANNEL_TYPE_KEY = "channel_type";
    }

    /**
     * 是否能播放参数/专辑是否可看
     */
    public interface CANPALY_PARAMETERS {

        String MOD_VALUE = "passport";

        String CTL_VALUE = "index";

        String ACT_VALUE = "getService";

        String PID_KEY = "pid";

        String UNAME_KEY = "uname";

        String UID_KEY = "uid";

        String END_KEY = "end";

        String STORE_PATH = "storepath";
    }

    /**
     * 请求专辑付费信息参数
     */
    public interface ALBUMPAY_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "albumpay";

        String ACT_VALUE = "detail";

        String ID_VALUE = "id";
    }

    /**
     * 请求专辑视频列表参数 直播相关，旧接口
     */
    public interface VIDEOS_LIST_PARAMETERS {
        /*
         * http://static.meizi.app.m.letv.com/android/mod/mob/ctl/videolist/act/detail/id/{$id}/vid/{$vid}/b/{$b}
         * /s/{$s}/o/{$o}/m/{$m}/pcode/{$pcode}/version/{$version}.mindex.html
         */ String LUAMOD_VALUE = "main";

        String MOD_VALUE = "mob";

        String CTL_VALUE = "videolist";

        String ACT_VALUE = "detail";

        String ID_KEY = "id";// 专辑id

        String VID_KEY = "vid";// 视频id
        // 若使用此参数，则只返回当前vid所在页数的数据，已经所在页码和索引位置，不使用请不要传此参数
        String B_KEY = "b";// 页数--默认为1

        String S_KEY = "s";// 每页数量--默认为30

        String O_KEY = "o";// 排序方式--1:按着集数升序; 1:按着集数降序.默认为:-1

        String M_KEY = "m";// 合并输出--1:合并;
        // 2:请求非正片列表;1:合并; 0:不合并.默认为:0,不合并
        // 合并videoinfo，yugaopininfo，huaxuinfo，zixuninfo，otherinfo 这些视频列表，统一在videoinfo中输出
    }

    /**
     * 观影券使用
     * */
    public interface USE_TICKET {

        String MOD_VALUE = "passport";

        String CTL_VALUE = "index";

        String ACT_VALUE = "updTicketServlet";

        String USERID = "userid";

        String PID = "pid";

        String NAME = "name";

        String SIGN = "sign";
    }

    /**
     * 提交二维码信息接口参数
     */
    public interface QRCODE_PARAMETERS {

        String MOD_VALUE = "passport";

        String CTL_VALUE = "index";

        String ACT_VALUE = "submitQRCode";

        String QRCODE_GUID = "guid";

        String QRCODE_SSO_TK = "tk";

        String QRCODE_KEY = "key";
    }

    /**
     * 请求推送接口参数
     * */
    public interface PUSH_PARAMETERS {

        String MOD_VALUE = "minfo";

        String CTL_VALUE = "pushmsg";

        String ACT_VALUE = "index";

        String ID_KEY = "id";

        String DEV_ID_KEY = "dev_id";

        String MSGID_KEY = "msgid";

        String CITY_KEY = "city";
    }

    /**
     * 首页应用弹窗推荐接口
     * */
    public interface EXCHANGEPOP_PARAMETERS {

        String MOD_VALUE = "mob";

        String CTL_VALUE = "exchangepop";

        String ACT_VALUE = "pop";
    }

    /**
     * 检查token接口
     * */
    public interface CLIENTCHECKTICKET_PARAMETERS {

        String MOD_VALUE = "passport";

        String CTL_VALUE = "index";

        String ACT_VALUE = "clientCheckTicket";

        String TK_KEY = "tk";
    }

    /**
     * 摇一摇
     * 
     * @author zhuqiao
     *
     */
    public interface SHAKE_SUBMIT {

        String MOD_VALUE = "minfo";

        String CTL_VALUE = "shake";

        String ACT_VALUE = "add";

        String AID_KEY = "aid";

        String VID_KEY = "vid";

        String UUID_KEY = "uuid";

        String PLAYTIME_KEY = "playtime";

        String VTYPE_KEY = "vtype";

        String LONGITUDE_KEY = "longitude";

        String LATITUDE_KEY = "latitude";
    }

    public interface SHAKE_COMMIT {

        String MOD_VALUE = "minfo";

        String CTL_VALUE = "shake";

        String ACT_VALUE = "get";

        String UUID_KEY = "uuid";

        String LONGITUDE_KEY = "longitude";

        String LATITUDE_KEY = "latitude";
    }
    
    /**
     * 得到动态地址
     * */
    public static String getDynamicUrl() {
        if (PreferencesManager.getInstance().isTestApi()
        		&& LetvConfig.isForTest()) {
            return TEST_URL.DYNAMIC_TEST_BASE_URL;
        } else {
            return USER_DYNAMIC_APP_URL;
        }
    }
}
